﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using TCG.Engine.Core;

namespace TCG.Engine.Tests.Mocks
{
    public class DummyInteraction : IPlayerInteraction
    {
        Player player;
        Queue<Func<Player, Card>> moves;
        
        public DummyInteraction(Player player)
        {
            this.player = player;
        }

        public void Clear()
        {
            moves = new Queue<Func<Player, Card>>();
        }

        public void Move(Func<Player, Card> move)
        {
            moves.Enqueue(move);
        }

        Card IPlayerInteraction.Move()
        {
            if (!moves.Any())
                return null;

            return moves.Dequeue()(player);
        }

        Card IPlayerInteraction.DiscardCard()
        {
            throw new NotImplementedException();
        }

        IEnumerable<Card> IPlayerInteraction.DiscardCards(int count)
        {
            return Enumerable.Range(0, count).Select(i => player.Hand.ElementAt(i));
        }


        Action onNotEnoughResources;
        public void OnNotEnoughResources(Action onNotEnoughResources)
        {
            this.onNotEnoughResources = onNotEnoughResources;
        }

        public void NotEnoughResources()
        {
            onNotEnoughResources();
        }

        public int SelectGold()
        {
            throw new NotImplementedException();
        }

        public int SelectMana()
        {
            return 4;
        }
    }
}
